home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_qt.idb / usr / freeware / include / Qt / qframe.h.z / qframe.h
Encoding:
C/C++ Source or Header  |  1998-10-28  |  3.0 KB  |  122 lines

  1. /****************************************************************************
  2. ** $Id: qframe.h,v 2.7 1998/07/03 00:09:48 hanord Exp $
  3. **
  4. ** Definition of QFrame widget class
  5. **
  6. ** Created : 950201
  7. **
  8. ** Copyright (C) 1992-1998 Troll Tech AS.  All rights reserved.
  9. **
  10. ** This file is part of Qt Free Edition, version 1.40.
  11. **
  12. ** See the file LICENSE included in the distribution for the usage
  13. ** and distribution terms, or http://www.troll.no/free-license.html.
  14. **
  15. ** IMPORTANT NOTE: You may NOT copy this file or any part of it into
  16. ** your own programs or libraries.
  17. **
  18. ** Please see http://www.troll.no/pricing.html for information about 
  19. ** Qt Professional Edition, which is this same library but with a
  20. ** license which allows creation of commercial/proprietary software.
  21. **
  22. *****************************************************************************/
  23.  
  24. #ifndef QFRAME_H
  25. #define QFRAME_H
  26.  
  27. #ifndef QT_H
  28. #include "qwidget.h"
  29. #endif // QT_H
  30.  
  31.  
  32. class QFrame : public QWidget            // frame class
  33. {
  34.     Q_OBJECT
  35. public:
  36.     QFrame( QWidget *parent=0, const char *name=0, WFlags f=0,
  37.         bool allowLines=TRUE );
  38.  
  39.     enum { NoFrame  = 0,            // no frame
  40.        Box        = 0x0001,            // rectangular box
  41.        Panel    = 0x0002,            // rectangular panel
  42.        WinPanel = 0x0003,            // rectangular panel (Windows)
  43.        HLine    = 0x0004,            // horizontal line
  44.        VLine    = 0x0005,            // vertical line
  45.        MShape   = 0x000f,
  46.        Plain    = 0x0010,            // plain line
  47.        Raised   = 0x0020,            // raised shadow effect
  48.        Sunken   = 0x0030,            // sunken shadow effect
  49.        MShadow  = 0x00f0 };
  50.  
  51.     int        frameStyle()    const;
  52.     int        frameShape()    const;
  53.     int        frameShadow()    const;
  54.     void    setFrameStyle( int );
  55.  
  56.     bool    lineShapesOk()    const;
  57.  
  58.     int        lineWidth()    const;
  59.     void    setLineWidth( int );
  60.  
  61.     int        margin()    const;
  62.     void    setMargin( int );
  63.  
  64.     int        midLineWidth()    const;
  65.     void    setMidLineWidth( int );
  66.  
  67.     int        frameWidth()    const;
  68.     QRect    frameRect()    const;
  69.     QRect    contentsRect()    const;
  70.  
  71.     QSize    sizeHint() const;
  72.  
  73. protected:
  74.     void    setFrameRect( const QRect & );
  75.     void    paintEvent( QPaintEvent * );
  76.     void    resizeEvent( QResizeEvent * );
  77.     virtual void drawFrame( QPainter * );
  78.     virtual void drawContents( QPainter * );
  79.     virtual void frameChanged();
  80.  
  81. private:
  82.     void    updateFrameWidth();
  83.     QRect    frect;
  84.     int        fstyle;
  85.     short    lwidth;
  86.     short    mwidth;
  87.     short    fwidth;
  88.     short    lineok;
  89.  
  90. private:    // Disabled copy constructor and operator=
  91.     QFrame( const QFrame & );
  92.     QFrame &operator=( const QFrame & );
  93. };
  94.  
  95.  
  96. inline int QFrame::frameStyle() const
  97. { return fstyle; }
  98.  
  99. inline int QFrame::frameShape() const
  100. { return fstyle & MShape; }
  101.  
  102. inline int QFrame::frameShadow() const
  103. { return fstyle & MShadow; }
  104.  
  105. inline bool QFrame::lineShapesOk() const
  106. { return lineok; }                // ### Qt 2.0: bool
  107.  
  108. inline int QFrame::lineWidth() const
  109. { return lwidth; }
  110.  
  111. inline int QFrame::midLineWidth() const
  112. { return mwidth & 0x00ff; }
  113.  
  114. inline int QFrame::margin() const
  115. { return ((int)mwidth) >> 8; }
  116.  
  117. inline int QFrame::frameWidth() const
  118. { return fwidth; }
  119.  
  120.  
  121. #endif // QFRAME_H
  122.